<?php
abstract class Controller {
	protected $registry;

	public function __construct($registry) {
		$this->registry = $registry;
	}

	public function __get($key) {
		return $this->registry->get($key);
	}

	public function __set($key, $value) {
		$this->registry->set($key, $value);
	}
	
	public function actionCheck($must_login = true,$post_only = false)
	{
	    if ($must_login && !$this->customer->isLogged()) {
	        $this->response->setDataResult(3,"未登录！",null);
	        return false;
	    }
	    if($post_only && !($this->request->server['REQUEST_METHOD'] == 'POST'))
	    {
	        $this->response->setDataResult(0,"非法请求！(POST only)",null);
	        return false;
	    }
	    return true;
	}
}